﻿using System;

namespace WeiSha.Core.Method.Snowflake
{
	// Token: 0x0200003D RID: 61
	public class Generate
	{
		// Token: 0x0600028E RID: 654 RVA: 0x000117D4 File Offset: 0x0000F9D4
		public static long Next()
		{
			return Generate.getInstance().idworker.NextID();
		}

		// Token: 0x0600028F RID: 655 RVA: 0x000117F8 File Offset: 0x0000F9F8
		private Generate()
		{
			this.worker_serial = App.Get["Snowflake_WorkerID"].Int32 ?? 1;
			this.idworker = new SnowflakeTool((long)this.worker_serial);
		}

		// Token: 0x06000290 RID: 656 RVA: 0x0001185C File Offset: 0x0000FA5C
		private static Generate getInstance()
		{
			bool flag = Generate.instance == null;
			if (flag)
			{
				object @lock = Generate._lock;
				lock (@lock)
				{
					bool flag3 = Generate.instance == null;
					if (flag3)
					{
						Generate.instance = new Generate();
					}
				}
			}
			return Generate.instance;
		}

		// Token: 0x040000C4 RID: 196
		private SnowflakeTool idworker = null;

		// Token: 0x040000C5 RID: 197
		private static readonly object _lock = new object();

		// Token: 0x040000C6 RID: 198
		private int worker_serial = 1;

		// Token: 0x040000C7 RID: 199
		private static Generate instance = null;
	}
}
